package com.kmwiki.Utility;
import java.text.SimpleDateFormat;
import java.util.Date;

public class myDate {

	public static enum DateFormat { 
		C10, C10withSlash, C10withDot,C10withHyphen;

		  public String toString() {
		    switch(this) {
		      case C10:   		 return "yyyyMMdd";
		      case C10withSlash: return "yyyy/MM/dd";
		      case C10withDot:   return "yyyy.MM.dd";
		      case C10withHyphen:   return "yyyy-MM-dd";		      
		      default:  return "yyyy-MM-dd";
		    }
		  }
	}	
	
	public static String DateToString(Date dt, DateFormat dtformat)
	{
		String result = "";
		SimpleDateFormat sdtformat = new SimpleDateFormat(dtformat.toString());
		//"yyyy-MM-dd HH:mm:ss"
		result = sdtformat.format(dt);
		return result;
	}
	
	public static String DateToString()
	{
		String result = "";
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		Date date = new Date();
		result = dateFormat.format(date);
		return result;
	}
	
	public static String DateToString(DateFormat dtformat)
	{
		String result = "";
		Date dt = new java.util.Date();
		SimpleDateFormat sdtformat = new SimpleDateFormat(dtformat.toString());
		result = sdtformat.format(dt);
		return result;
	}
	
	public static String DateTimeToString(Date dt, DateFormat dtformat)
	{
		String result = "";
		SimpleDateFormat sdtformat = new SimpleDateFormat(dtformat.toString() + " HH:mm:ss");
		result = sdtformat.format(dt);
		return result;
	}

	public static String DateTimeToString(DateFormat dtformat)
	{
		return DateTimeToString(Now(),dtformat);
	}

	public static String TimeToString()
	{
		String result = "";
		SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); 
		Date date = new Date();
		result = dateFormat.format(date);
		return result;
	}
	
	
	public static Date Now()
	{
		return (new java.util.Date());
	}
}
